#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main()
{
    int i = 0;
    int ret = 0;
    for (i = 1; i <= 2019; i++)
    {
        int m = i;
        while (m)
        {
            if (m % 10 == 9)
            {
                ret++;
                break;
            }
            else {
                m /= 10;
            }
        }
    }
    printf("%d\n", ret);
    return 0;
}